package com.wlr.study.leetcode;

import java.util.ArrayList;
import java.util.List;
import java.util.Stack;

/**
 * 删除第K个节点
 */
public class LeetCode94 {
    public List<Integer> inorderTraversal(TreeNode root) {
        Stack<TreeNode> stack = new Stack<>();
        List<Integer> result = new ArrayList<>();
        TreeNode init = root;
        while (init!=null || !stack.isEmpty()){
            while (init!=null){
                stack.push(init);
                init=init.left;
            }
            init = stack.pop();
            result.add(init.val);
            init = init.right;
        }
        return result;

    }
}
